

<!DOCTYPE html>
<html class="writer-html5" lang="en" >
<head>
  <meta charset="utf-8" />
  
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  
  <title>warp_drive package &mdash; WarpDrive 1.0 documentation</title>
  

  
  <link rel="stylesheet" href="_static/css/theme.css" type="text/css" />
  <link rel="stylesheet" href="_static/pygments.css" type="text/css" />
  <link rel="stylesheet" href="_static/pygments.css" type="text/css" />
  <link rel="stylesheet" href="_static/css/theme.css" type="text/css" />
  <link rel="stylesheet" href="https://assets.readthedocs.org/static/css/badge_only.css" type="text/css" />

  
  

  
  

  

  
  <!--[if lt IE 9]>
    <script src="_static/js/html5shiv.min.js"></script>
  <![endif]-->
  
    
      <script type="text/javascript" id="documentation_options" data-url_root="./" src="_static/documentation_options.js"></script>
        <script data-url_root="./" id="documentation_options" src="_static/documentation_options.js"></script>
        <script src="_static/jquery.js"></script>
        <script src="_static/underscore.js"></script>
        <script src="_static/doctools.js"></script>
        <script async="async" src="https://assets.readthedocs.org/static/javascript/readthedocs-doc-embed.js"></script>
    
    <script type="text/javascript" src="_static/js/theme.js"></script>

    
    <link rel="index" title="Index" href="genindex.html" />
    <link rel="search" title="Search" href="search.html" />
    <link rel="next" title="warp_drive.managers package" href="warp_drive.managers.html" />
    <link rel="prev" title="&lt;no title&gt;" href="modules.html" /> 

<!-- RTD Extra Head -->

<link rel="stylesheet" href="https://assets.readthedocs.org/static/css/readthedocs-doc-embed.css" type="text/css" />

<script type="application/json" id="READTHEDOCS_DATA">{"ad_free": "", "api_host": "", "build_date": "2021-08-31T22:53:14Z", "builder": "sphinx", "canonical_url": "", "commit": "", "docroot": "", "features": {"docsearch_disabled": false}, "global_analytics_code": null, "language": "", "page": "warp_drive", "programming_language": "", "project": "", "source_suffix": ".rst", "subprojects": {}, "theme": "", "user_analytics_code": null, "version": ""}</script>

<!--
Using this variable directly instead of using `JSON.parse` is deprecated.
The READTHEDOCS_DATA global variable will be removed in the future.
-->
<script type="text/javascript">
READTHEDOCS_DATA = JSON.parse(document.getElementById('READTHEDOCS_DATA').innerHTML);
</script>

<script type="text/javascript" src="https://assets.readthedocs.org/static/javascript/readthedocs-analytics.js" async="async"></script>

<!-- end RTD <extrahead> -->
</head>

<body class="wy-body-for-nav">

   
  <div class="wy-grid-for-nav">
    
    <nav data-toggle="wy-nav-shift" class="wy-nav-side">
      <div class="wy-side-scroll">
        <div class="wy-side-nav-search" >
          

          
            <a href="index.html" class="icon icon-home"> WarpDrive
          

          
          </a>

          
            
            
          

          
<div role="search">
  <form id="rtd-search-form" class="wy-form" action="search.html" method="get">
    <input type="text" name="q" placeholder="Search docs" />
    <input type="hidden" name="check_keywords" value="yes" />
    <input type="hidden" name="area" value="default" />
  </form>
</div>

          
        </div>

        
        <div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
          
            
            
              
            
            
              <p class="caption" role="heading"><span class="caption-text">Contents:</span></p>
<ul class="current">
<li class="toctree-l1 current"><a class="current reference internal" href="#">warp_drive package</a><ul>
<li class="toctree-l2"><a class="reference internal" href="#subpackages">Subpackages</a><ul>
<li class="toctree-l3"><a class="reference internal" href="warp_drive.managers.html">warp_drive.managers package</a></li>
<li class="toctree-l3"><a class="reference internal" href="warp_drive.training.html">warp_drive.training package</a></li>
<li class="toctree-l3"><a class="reference internal" href="warp_drive.utils.html">warp_drive.utils package</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="#submodules">Submodules</a></li>
<li class="toctree-l2"><a class="reference internal" href="#module-warp_drive.env_cpu_gpu_consistency_checker">warp_drive.env_cpu_gpu_consistency_checker module</a></li>
<li class="toctree-l2"><a class="reference internal" href="#module-warp_drive.env_wrapper">warp_drive.env_wrapper module</a></li>
<li class="toctree-l2"><a class="reference internal" href="#module-warp_drive">Module contents</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="example_envs.html">example_envs package</a></li>
</ul>

            
          
        </div>
        
      </div>
    </nav>

    <section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">

      
      <nav class="wy-nav-top" aria-label="top navigation">
        
          <i data-toggle="wy-nav-top" class="fa fa-bars"></i>
          <a href="index.html">WarpDrive</a>
        
      </nav>


      <div class="wy-nav-content">
        
        <div class="rst-content">
        
          

















<div role="navigation" aria-label="breadcrumbs navigation">

  <ul class="wy-breadcrumbs">
    
      <li><a href="index.html" class="icon icon-home"></a> &raquo;</li>
        
          <li><a href="modules.html">&lt;no title&gt;</a> &raquo;</li>
        
      <li>warp_drive package</li>
    
    
      <li class="wy-breadcrumbs-aside">
        
          
            <a href="_sources/warp_drive.rst.txt" rel="nofollow"> View page source</a>
          
        
      </li>
    
  </ul>

  
  <hr/>
</div>
          <div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
           <div itemprop="articleBody">
            
  <div class="section" id="warp-drive-package">
<h1>warp_drive package<a class="headerlink" href="#warp-drive-package" title="Permalink to this headline">¶</a></h1>
<div class="section" id="subpackages">
<h2>Subpackages<a class="headerlink" href="#subpackages" title="Permalink to this headline">¶</a></h2>
<div class="toctree-wrapper compound">
<ul>
<li class="toctree-l1"><a class="reference internal" href="warp_drive.managers.html">warp_drive.managers package</a><ul>
<li class="toctree-l2"><a class="reference internal" href="warp_drive.managers.html#submodules">Submodules</a></li>
<li class="toctree-l2"><a class="reference internal" href="warp_drive.managers.html#module-warp_drive.managers.data_manager">warp_drive.managers.data_manager module</a></li>
<li class="toctree-l2"><a class="reference internal" href="warp_drive.managers.html#module-warp_drive.managers.function_manager">warp_drive.managers.function_manager module</a></li>
<li class="toctree-l2"><a class="reference internal" href="warp_drive.managers.html#module-warp_drive.managers">Module contents</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="warp_drive.training.html">warp_drive.training package</a><ul>
<li class="toctree-l2"><a class="reference internal" href="warp_drive.training.html#subpackages">Subpackages</a><ul>
<li class="toctree-l3"><a class="reference internal" href="warp_drive.training.algorithms.html">warp_drive.training.algorithms package</a><ul>
<li class="toctree-l4"><a class="reference internal" href="warp_drive.training.algorithms.html#submodules">Submodules</a></li>
<li class="toctree-l4"><a class="reference internal" href="warp_drive.training.algorithms.html#module-warp_drive.training.algorithms.a2c">warp_drive.training.algorithms.a2c module</a></li>
<li class="toctree-l4"><a class="reference internal" href="warp_drive.training.algorithms.html#module-warp_drive.training.algorithms.ppo">warp_drive.training.algorithms.ppo module</a></li>
<li class="toctree-l4"><a class="reference internal" href="warp_drive.training.algorithms.html#module-warp_drive.training.algorithms">Module contents</a></li>
</ul>
</li>
<li class="toctree-l3"><a class="reference internal" href="warp_drive.training.models.html">warp_drive.training.models package</a><ul>
<li class="toctree-l4"><a class="reference internal" href="warp_drive.training.models.html#submodules">Submodules</a></li>
<li class="toctree-l4"><a class="reference internal" href="warp_drive.training.models.html#module-warp_drive.training.models.fully_connected">warp_drive.training.models.fully_connected module</a></li>
<li class="toctree-l4"><a class="reference internal" href="warp_drive.training.models.html#module-warp_drive.training.models">Module contents</a></li>
</ul>
</li>
<li class="toctree-l3"><a class="reference internal" href="warp_drive.training.utils.html">warp_drive.training.utils package</a><ul>
<li class="toctree-l4"><a class="reference internal" href="warp_drive.training.utils.html#submodules">Submodules</a></li>
<li class="toctree-l4"><a class="reference internal" href="warp_drive.training.utils.html#module-warp_drive.training.utils.data_loader">warp_drive.training.utils.data_loader module</a></li>
<li class="toctree-l4"><a class="reference internal" href="warp_drive.training.utils.html#module-warp_drive.training.utils">Module contents</a></li>
</ul>
</li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="warp_drive.training.html#submodules">Submodules</a></li>
<li class="toctree-l2"><a class="reference internal" href="warp_drive.training.html#warp-drive-training-example-training-script-module">warp_drive.training.example_training_script module</a></li>
<li class="toctree-l2"><a class="reference internal" href="warp_drive.training.html#module-warp_drive.training.trainer">warp_drive.training.trainer module</a></li>
<li class="toctree-l2"><a class="reference internal" href="warp_drive.training.html#module-warp_drive.training">Module contents</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="warp_drive.utils.html">warp_drive.utils package</a><ul>
<li class="toctree-l2"><a class="reference internal" href="warp_drive.utils.html#submodules">Submodules</a></li>
<li class="toctree-l2"><a class="reference internal" href="warp_drive.utils.html#module-warp_drive.utils.common">warp_drive.utils.common module</a></li>
<li class="toctree-l2"><a class="reference internal" href="warp_drive.utils.html#module-warp_drive.utils.constants">warp_drive.utils.constants module</a></li>
<li class="toctree-l2"><a class="reference internal" href="warp_drive.utils.html#module-warp_drive.utils.data_feed">warp_drive.utils.data_feed module</a></li>
<li class="toctree-l2"><a class="reference internal" href="warp_drive.utils.html#module-warp_drive.utils.recursive_obs_dict_to_spaces_dict">warp_drive.utils.recursive_obs_dict_to_spaces_dict module</a></li>
<li class="toctree-l2"><a class="reference internal" href="warp_drive.utils.html#module-warp_drive.utils">Module contents</a></li>
</ul>
</li>
</ul>
</div>
</div>
<div class="section" id="submodules">
<h2>Submodules<a class="headerlink" href="#submodules" title="Permalink to this headline">¶</a></h2>
</div>
<div class="section" id="module-warp_drive.env_cpu_gpu_consistency_checker">
<span id="warp-drive-env-cpu-gpu-consistency-checker-module"></span><h2>warp_drive.env_cpu_gpu_consistency_checker module<a class="headerlink" href="#module-warp_drive.env_cpu_gpu_consistency_checker" title="Permalink to this headline">¶</a></h2>
<p>Consistency tests for comparing the cuda (gpu) / no cuda (cpu) version</p>
<dl class="py class">
<dt class="sig sig-object py" id="warp_drive.env_cpu_gpu_consistency_checker.EnvironmentCPUvsGPU">
<em class="property"><span class="pre">class</span> </em><span class="sig-prename descclassname"><span class="pre">warp_drive.env_cpu_gpu_consistency_checker.</span></span><span class="sig-name descname"><span class="pre">EnvironmentCPUvsGPU</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">env_class</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">env_configs</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">num_envs</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">2</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">num_episodes</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">2</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">use_gpu_testing_mode</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">True</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#warp_drive.env_cpu_gpu_consistency_checker.EnvironmentCPUvsGPU" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <code class="xref py py-class docutils literal notranslate"><span class="pre">object</span></code></p>
<p>test the rollout consistency between the CPU environment and the GPU environment</p>
<dl class="py method">
<dt class="sig sig-object py" id="warp_drive.env_cpu_gpu_consistency_checker.EnvironmentCPUvsGPU.run_consistency_checks">
<em class="property"><span class="pre">static</span> </em><span class="sig-name descname"><span class="pre">run_consistency_checks</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">cpu_value</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">gpu_value</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">decimal_places</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">3</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#warp_drive.env_cpu_gpu_consistency_checker.EnvironmentCPUvsGPU.run_consistency_checks" title="Permalink to this definition">¶</a></dt>
<dd><p>Perform consistency checks between the cpu and gpu values.
The default threshold is 3 decimal places.</p>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="warp_drive.env_cpu_gpu_consistency_checker.EnvironmentCPUvsGPU.test_env_reset_and_step">
<span class="sig-name descname"><span class="pre">test_env_reset_and_step</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#warp_drive.env_cpu_gpu_consistency_checker.EnvironmentCPUvsGPU.test_env_reset_and_step" title="Permalink to this definition">¶</a></dt>
<dd><p>Perform consistency checks for the reset() and step() functions</p>
</dd></dl>

</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="warp_drive.env_cpu_gpu_consistency_checker.generate_random_actions">
<span class="sig-prename descclassname"><span class="pre">warp_drive.env_cpu_gpu_consistency_checker.</span></span><span class="sig-name descname"><span class="pre">generate_random_actions</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">env</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">num_envs</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#warp_drive.env_cpu_gpu_consistency_checker.generate_random_actions" title="Permalink to this definition">¶</a></dt>
<dd><p>Generate random actions for each agent and each env.</p>
</dd></dl>

</div>
<div class="section" id="module-warp_drive.env_wrapper">
<span id="warp-drive-env-wrapper-module"></span><h2>warp_drive.env_wrapper module<a class="headerlink" href="#module-warp_drive.env_wrapper" title="Permalink to this headline">¶</a></h2>
<p>The env wrapper class</p>
<dl class="py class">
<dt class="sig sig-object py" id="warp_drive.env_wrapper.EnvWrapper">
<em class="property"><span class="pre">class</span> </em><span class="sig-prename descclassname"><span class="pre">warp_drive.env_wrapper.</span></span><span class="sig-name descname"><span class="pre">EnvWrapper</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">env_obj</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">num_envs</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">1</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">use_cuda</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">False</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">testing_mode</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">False</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#warp_drive.env_wrapper.EnvWrapper" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <code class="xref py py-class docutils literal notranslate"><span class="pre">object</span></code></p>
<p>The environment wrapper class.
This wrapper determines whether the environment reset and steps happen on the
CPU or the GPU, and proceeds accordingly.
If the environment runs on the CPU, the reset() and step() calls also occur on
the CPU
If the environment runs on the GPU, only the first reset() happens on the CPU,
all the relevant data is copied over the GPU after, and the subsequent steps
all happen on the GPU</p>
<dl class="py method">
<dt class="sig sig-object py" id="warp_drive.env_wrapper.EnvWrapper.reset_all_envs">
<span class="sig-name descname"><span class="pre">reset_all_envs</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#warp_drive.env_wrapper.EnvWrapper.reset_all_envs" title="Permalink to this definition">¶</a></dt>
<dd><p>Reset the state of the environment to initialize a new episode.
if self.reset_on_host is True:</p>
<blockquote>
<div><p>calls the CPU env to prepare and return the initial state</p>
</div></blockquote>
<dl class="simple">
<dt>if self.use_cuda is True:</dt><dd><dl class="simple">
<dt>if self.reset_on_host is True:</dt><dd><p>expands initial state to parallel example_envs and push to GPU once
sets self.reset_on_host = False</p>
</dd>
<dt>else:</dt><dd><p>calls device hard reset managed by the CUDAResetter</p>
</dd>
</dl>
</dd>
</dl>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="warp_drive.env_wrapper.EnvWrapper.reset_only_done_envs">
<span class="sig-name descname"><span class="pre">reset_only_done_envs</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#warp_drive.env_wrapper.EnvWrapper.reset_only_done_envs" title="Permalink to this definition">¶</a></dt>
<dd><p>This function only works for GPU example_envs.
It will check all the running example_envs,
and only resets those example_envs that are observing done flag is True</p>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="warp_drive.env_wrapper.EnvWrapper.step">
<span class="sig-name descname"><span class="pre">step</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">actions</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#warp_drive.env_wrapper.EnvWrapper.step" title="Permalink to this definition">¶</a></dt>
<dd><p>Step through the environment</p>
</dd></dl>

</dd></dl>

</div>
<div class="section" id="module-warp_drive">
<span id="module-contents"></span><h2>Module contents<a class="headerlink" href="#module-warp_drive" title="Permalink to this headline">¶</a></h2>
</div>
</div>


           </div>
           
          </div>
          <footer>
    <div class="rst-footer-buttons" role="navigation" aria-label="footer navigation">
        <a href="warp_drive.managers.html" class="btn btn-neutral float-right" title="warp_drive.managers package" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right" aria-hidden="true"></span></a>
        <a href="modules.html" class="btn btn-neutral float-left" title="&lt;no title&gt;" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left" aria-hidden="true"></span> Previous</a>
    </div>

  <hr/>

  <div role="contentinfo">
    <p>
        &#169; Copyright 2021, Tian Lan, Sunil Srinivasa, Stephan Zheng.

    </p>
  </div>
    
    
    
    Built with <a href="https://www.sphinx-doc.org/">Sphinx</a> using a
    
    <a href="https://github.com/readthedocs/sphinx_rtd_theme">theme</a>
    
    provided by <a href="https://readthedocs.org">Read the Docs</a>. 

</footer>
        </div>
      </div>

    </section>

  </div>
  

  <script type="text/javascript">
      jQuery(function () {
          SphinxRtdTheme.Navigation.enable(true);
      });
  </script>

  
  
    
   

</body>
</html>